// 引入request
import request from '../util/request.js';
import config from '../util/config.js';
const StepRequest = {
    BASE_URL : config.proUrl + "/pro",
    // 请求过程在这里开发，不在.vue文件中开发
    /**
     * 分页查询步骤信息的API
     * @param step
     * @param callBack
     */
    loadStepItem(step, callBack){
        // 拼接url  /sys/queryByPage?xxx
        console.log("请求参数是"+step)
        let url = this.BASE_URL + "/step/queryByPage";
        //let url = this.BASE_URL + "/step/queryByPage";  调用request进行请求  http://lcation
        request.get(url,step,callBack);
    },

    /**
     * 添加步骤的API
     * @param step
     * @param callBack
     */
    addStepItem(step,callBack){
        let url = this.BASE_URL + "/step/saveStep"
        request.post(url,step,callBack);
    },
    /**
     * 通过id查询步骤信息的API
     * @param processStepId
     * @param callBack
     */
    getById(processStepId,callBack){
        let url = this.BASE_URL + "/step/queryById?processStepId=" + processStepId;
        request.get(url,null,callBack);
    }
    ,
    /**
     * 修改步骤信息的API
     * @param step
     * @param callBack
     */
    updateStep(step,callBack){
        let url = this.BASE_URL + "/step/updateStep";
        request.post(url,step,callBack);
    },
    /**
     *  删除步骤的API
     *  @param processStepId
     *  @param callBack
     */
    deleteStep(processStepId,callBack){
        request.get(this.BASE_URL + "/step/delete?processStepId=" + processStepId,null,callBack);
    },
    /**
     * 批量删除步骤的API
     * @param stepIds
     * @param callBack
     */
    deleteSteps(processStepIds,callBack){
        let url = this.BASE_URL + "/step/deletes?a=1";
        // for (let i = 0; i < processStepIds.length; i++){
        //     url += "&processStepId="+processStepIds[i];
        // }
        url += "&processStepIds="+processStepIds;
        request.get(url,null,callBack);
    }
}
// 导出我们申明的steprequest对象
export default StepRequest;